import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const router = createRouter({
  //路由模式 history hash模式
  history: createWebHistory(import.meta.env.BASE_URL),
  //路由列表 有多个链接就应该一个链接对应一个路由记录
  routes: [
    {//一条路由记录
      path: '/',
      name: 'home',
      component: HomeView
    },
    {
      path:"/detail/:storyid",
      name:"detail",
      component:()=>import("../views/DetailView.vue")
    },
    {
      path:"/comments/:storyid",
      name:"Comments",
      component:()=>import("../views/CommentsView.vue")
    },
    {
      path: '/userset',
      name: 'userset',
    
      component: () => import('../views/UsersetView.vue')
    },
    {
      path: '/about',
      name: 'about',
      // route level code-splitting
      // this generates a separate chunk (About.[hash].js) for this route
      // which is lazy-loaded when the route is visited.
      component: () => import('../views/AboutView.vue')
    }
  ]
})

export default router
